local ____lualib = require("lualib_bundle")
local __TS__Class = ____lualib.__TS__Class
local __TS__New = ____lualib.__TS__New
local NetDispatcher = __TS__Class()
NetDispatcher.name = "NetDispatcher"
function NetDispatcher.prototype.____constructor(self)
    self.dispatcher = {}
end
function NetDispatcher.prototype.NetDispatcher(self)
    self.dispatcher = {}
    _G.OnNetMsg = function(...) return self:OnNetMsg(...) end
end
function NetDispatcher.prototype.reg(self, proc, system_id, msg_id)
    if proc == nil then
        return false
    end
    if self.dispatcher[system_id + 1] == nil then
        self.dispatcher[system_id + 1] = {}
    end
    self.dispatcher[system_id + 1][msg_id + 1] = proc
    System.regScriptNetMsg(system_id, msg_id)
    return true
end
function NetDispatcher.prototype.OnNetMsg(self, system_id, msg_id, actor, net_pack)
    if self.dispatcher[system_id + 1] == nil then
        print((("未注册的消息处理器：system=" .. tostring(system_id)) .. ", msg=") .. tostring(msg_id))
        return
    end
    local procs = self.dispatcher[system_id + 1][msg_id + 1]
    if procs == nil then
        return
    end
    procs(actor, net_pack)
end
local ____exports = __TS__New(NetDispatcher)
return ____exports
